# Maintainer: Guillaume Horel <guillaume.horel@gmail.com>

pkgname='arrow'
pkgver=5.0.0
pkgrel=1
pkgdesc="A columnar in-memory analytics layer for big data."
arch=('x86_64')
url="https://arrow.apache.org"
license=('Apache')
depends=('boost-libs' 'double-conversion' 'c-ares' 'gflags' 'google-glog' 'libutf8proc' 'lz4' 'protobuf' 'rapidjson' 'thrift' 'uriparser' 'zstd')
checkdepends=('git')
optdepends=()
provides=('parquet-cpp')
conflicts=('parquet-cpp')
makedepends=('boost' 'cmake' 'flatbuffers' 'python-numpy')
source=("https://github.com/apache/arrow/archive/apache-arrow-$pkgver.tar.gz")
sha256sums=('ec3bdae6ccc08de5b5adcf9cbe7cbc085cab0ba06c8e6d3abfc3ed1cd4c1c9a2')

build(){
  cd "$srcdir"
  patch -p1 $pkgname-apache-$pkgname-$pkgver/cpp/src/arrow/util/tdigest.cc < ../add-missing-limits-include.patch
  mkdir -p build
  cd "$srcdir/build"
  ARROW_BUILD_TOOLCHAIN=/usr DOUBLE_CONVERSION_HOME=/usr cmake \
    ../$pkgname-apache-$pkgname-$pkgver/cpp -DARROW_DEPENDENCY_SOURCE=SYSTEM \
                                      -DCMAKE_GENERATOR="Unix Makefiles" \
                                      -DARROW_PYTHON=ON \
                                      -DCMAKE_BUILD_TYPE=Release \
                                      -DBUILD_SHARED_LIBS=ON \
                                      -DARROW_BUILD_TESTS=OFF \
                                      -DARROW_ALTIVEC=OFF \
                                      -DCMAKE_INSTALL_PREFIX="/usr" \
                                      -DCMAKE_INSTALL_LIBDIR="lib" \
                                      -DARROW_COMPUTE=ON \
                                      -DARROW_IPC=ON \
                                      -DARROW_JEMALLOC=ON \
                                      -DARROW_ORC=OFF \
                                      -DARROW_PARQUET=ON \
                                      -DARROW_PLASMA=ON \
                                      -DARROW_TENSORFLOW=ON \
                                      -DARROW_FLIGHT=OFF \
                                      -DARROW_GANDIVA=OFF \
                                      -DARROW_PROTOBUF_USE_SHARED=ON \
                                      -DARROW_GFLAGS_USE_SHARED=ON \
                                      -DARROW_USE_GLOG=ON \
                                      -DARROW_WITH_ZSTD=BUNDLED \
                                      -DARROW_WITH_SNAPPY=BUNDLED \
                                      -DARROW_WITH_BROTLI=BUNDLED \
                                      -DARROW_WITH_ZLIB=BUNDLED \
                                      -DGTest_SOURCE=BUNDLED \
                                      -DgRPC_SOURCE=BUNDLED \
                                      -DARROW_S3=OFF \
                                      -DARROW_FILESYSTEM=OFF \
                                      -DARROW_CUDA=ON

  make -j $(nproc)
}

package(){
  cd "$srcdir/build"
  make -j $(nproc) DESTDIR="${pkgdir}" install
  find "${pkgdir}/usr/lib/" -name "*testing*" -delete
}


# vim:ts=2:sw=2:et:
